"""
主要用于字符串的操作：格式化输出、分割、切片、连接等
元组操作：格式化输出、切片、连接、重复、成员判断、索引等
列表操作：格式化输出、切片、连接、重复、成员判断、索引等
字典操作：格式化输出、切片、连接、重复、成员判断、索引等
"""

import re

text = "The quick brown fox jumps over the lazy dog. This is an example sentence for string operations."

# 使用切片获取前10个字符
first_ten_chars = text[:10]
print(first_ten_chars)

#使用推导式获取所有大写字母
for char in text:
    if char.isupper():
        print(char)

uppercase_letters = [char for char in text if char.isupper()]
print(uppercase_letters)

words = re.findall(r'\b\w+\b', text)
print(words)
